﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace MemcachedDemo.Library.Config
{
    [Serializable]
    public class ServerInfoCollection : CollectionBase
    {
        public ServerInfo this[int index]
        {
            get
            {
                return (ServerInfo)this.List[index];
            }
        }

        public int Add(ServerInfo item)
        {
            return this.List.Add(item);
        }

        public ServerInfo GetMimeItem(string ip)
        {
            foreach (ServerInfo item in this.List)
            {
                if (string.IsNullOrEmpty(item.Ip))
                {
                    continue;
                }

                if (string.Compare(item.Ip, ip, true) == 0)
                {
                    return item;
                }
            }
            return null;
        }
    }
}
